package com.ipharma.gui;

import com.ipharma.application.services.transaccion.TransactionRecharge;
import com.ipharma.dto.Product;

/**
 * A Swing-based panel class.
 * <P>
 * 
 * @author JorgE.H
 */
public class GUITransactionRecharge extends GUITransaction {

   /**
    * Attributes
    */

   /**
    * Panel
    */

   /**
    * Constructs a new instance.
    */
   public GUITransactionRecharge(GUIOperation pContainer) {

      super(pContainer);
   }

   /**
    * Adds an item to the transaction. Shows the transaction on screen.
    * 
    * @param pProd
    *           the product
    */
   public void addProduct(Product pProd, int pQty) {

      Product l_prod = (Product) pProd.clone();
      l_prod.setQuantity(pQty);
      if (selectedProducts == null)
         selectedProducts = new TransactionRecharge(theSess);
      selectedProducts.addItem(l_prod);

      jDetailArea.setText(jDetailArea.getText() + pProd.getDescription()
            + " - " + pQty);
   }
}
